<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php session_start(); $i=0; $j=0; ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Επεξεργασία Παραγγελιών</title>
    <link rel="stylesheet" type="text/css" href="../css/admin_style.css" />
    
    <script type='text/javascript'> 
		function procceed(item)
		{ 
			alert(procced);
			
		}
		
		function send(item)
		{ 
			alert(send);
			
		} 
	</script>
</head>

<body>
	<header id="banner">
		<?php echo '<h3><a href="../db_functions/dologout.php">Log Out</a></h3>'; ?>
   	</header>
    
    <div id="neworders">
           <h2 id="newo">Νέες Παραγγελίες</h2>
           <?php
            include '../db_functions/database.php'; 
            $connection=Connect();
            $query="select * from orders where order_status='ordered'";
            $result=mysql_query($query,$connection) or Die (mysql_error());
            echo"
			<table id=\"t_order\">
				<colgroup>
					<col width=\"1\" />
					<col width=\"20\" />
					<col width=\"200\" />
					<col width=\"500\" />
					<col width=\"20\" />
				</colgroup>
			<th>
				<td>No.</td>
				<td>Ημέρα/ Ώρα</td>
				<td>Περιγραφή</td>
				<td>Ολοκληρώθηκε</td>
			</th>";
            while ($row = mysql_fetch_array($result)) 
            {
				$i++;
                echo "<tr>
						<td></td>
						<td>".$i."</td>
						<td>".$row['order_datetime']."</td>
						<td>".$row['order_description']."</td>
						<td><input type=\"checkbox\" name=\"".$row['order_id']."\" value=\"crepe\" onclick='procceed(this.name);'/></td>
					  </tr>";                                        
            }
			echo "</table>";
			?>
    </div>
    <div id="ready" onclick="">
           <h2>Έτοιμες Παραγγελίες</h2> 
           <?php
            $query="select order_id, customers.* from orders,customers 
					where order_status='for delivery' AND order_customer_id=customer_id;";
            $result=mysql_query($query,$connection) or Die (mysql_error());
            echo"
			<table id=\"t_order\">
				<colgroup>
					<col width=\"1\" />
					<col width=\"20\" />
					<col width=\"200\" />
					<col width=\"500\" />
					<col width=\"20\" />
				</colgroup>
			<th>
				<td>No.</td>
				<td>πελάτης/ Ώρα</td>
				<td>Διεύθυνση</td>
				<td>Στάλθηκε</td>
			</th>";
            while ($row = mysql_fetch_array($result)) 
            {
				$j++;
                echo "<tr>
						<td></td>
						<td>".$j."</td>
						<td>".$row['customer_name']." ".$row['customer_surname']."</td>
						<td>".$row['customer_address']." Όροφος : ".$row['customer_floor']."</td>
						<td><input type=\"checkbox\" name=\"".$row['order_id']."\" value=\"crepe\" onclick='send(this.name);'/></td>
					  </tr>";                                        
            }
			echo "</table>";
			?>
    </div>
</body>
</html>
